C++ Templates: The Complete Guide by Vandevoorde David & Josuttis Nicolai M

C++ Templates: The Complete Guide by Vandevoorde David & Josuttis Nicolai M

Author:Vandevoorde, David & Josuttis, Nicolai M. [Vandevoorde, David]
Language: eng
Format: mobi
Publisher: Pearson Education
Published: 2002-11-11T16:00:00+00:00


accum<int>(&name[0],&name[length])

This is not an excessive constraint, but it can be avoided.

An alternative approach to the extra parameter is to create an association between each type T for which accum() is called and the corresponding type that should be used to hold the accumulated value. This association could be considered characteristic of the type T, and therefore the type in which the sum is computed is sometimes called a trait of T. As is turns out, our association can be encoded as specializations of a template:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.